<style>
    .layui-tab-title .layui-this:after {
        top: -1px;
    }
</style>
<script src="/Public/tinymce/tinymce.min.js"></script>
<script>
    tinymce.init({
        selector: '.editor',
        language: 'zh_CN',
        paste_data_images: true,
        content_style: "img {max-width:100%;}",
        plugins: 'print preview searchreplace autolink directionality visualchars fullscreen image template code table charmap hr nonbreaking advlist lists wordcount imagetools textpattern paste autoresize',
        toolbar: 'code undo redo restoredraft | forecolor backcolor bold italic underline strikethrough | blockquote subscript superscript removeformat | \
        alignleft aligncenter alignright alignjustify outdent indent indent2em lineheight | image | \
        formatselect fontselect fontsizeselect | \
        table charmap hr ',
        fontsize_formats: '12px 14px 16px 18px 21px 24px 26px 28px 30px 36px 48px 56px 72px',
        font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif 默认字体;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats;知乎配置=BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;小米配置=Helvetica Neue,Helvetica,Arial,Microsoft Yahei,Hiragino Sans GB,Heiti SC,WenQuanYi Micro Hei,sans-serif',
        autosave_ask_before_unload: false,
        toolbar_mode: 'wrap',
        images_upload_url: '/system/upload/img?type=image&dofor=tinymce',
        setup: function(editor) {
            editor.on('change', function() {
                editor.save();
            });
        }
    });
</script>
<div class="widget-head" style="margin-top:0;">
    <div class="widget-title">邮件模板</div>
</div>
<php> $types = ['reg'=>'注册验证码','findpwd'=>'找回密码验证码','thanks'=>'感谢']; //这里定义需要添加的邮箱模板 </php>
<php> $params = F('EMAIL_TEMPLATE') ? F('EMAIL_TEMPLATE') : null; </php>
<form class="layui-form" method="post" action="/system/api_admin/email_post">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <foreach name="types" item="item" key="key">
                <li <if condition="$key eq 'reg'">class="layui-this"</if>>{$item}</li>
            </foreach>
        </ul>
        <div class="layui-tab-content" style="padding-top:20px;">
            <foreach name="types" item="item" key="key">
                <div <if condition="$key eq 'reg'">class="layui-tab-item layui-show"
                    <else/>class="layui-tab-item"</if>>
                    <div class="layui-form-item">
                        <label class="layui-form-label">邮件标题：</label>
                        <div class="layui-input-block">
                            <input type="text" name="title[{$key}]" value="{$params['title'][$key]}" placeholder="请输入邮件标题" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">邮件作者：</label>
                        <div class="layui-input-block">
                            <input type="text" name="author[{$key}]" value="{$params['author'][$key]}" placeholder="请输入邮件作者" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">邮件模板：</label>
                        <div class="layui-input-block">
                            <textarea name="template[{$key}]" placeholder="请输入邮件模版" class="layui-textarea editor">{$params['template'][$key]}</textarea>
                        </div>
                    </div>
                </div>
            </foreach>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">保存</button>
        </div>
    </div>
</form>
<script>
    layui.use(['element'], function() {

    });
</script>